package drds.binlog.event;

import drds.binlog.LogByteBlock;
import drds.binlog.LogEvent;

/**
 * Logs xid of the transaction-to-be-committed in the 2pc protocol. Has no
 * meaning in replication, slaves ignore it.
 */
public final class XidLogEvent extends LogEvent
{

    private final long xid;

    public XidLogEvent(LogHeader logHeader, LogByteBlock logByteBlock, FormatDescriptionLogEvent formatDescriptionLogEvent)
    {
        super(logHeader);
        /* The Post-Header is empty. The Variable Data part begins immediately. */
        logByteBlock.index(formatDescriptionLogEvent.commonHeaderLength + formatDescriptionLogEvent.postHeaderLengths[XID_EVENT - 1]);
        xid = logByteBlock.getLong64BasedOnIndex(); // !uint8korr
    }

    public final long getXid()
    {
        return xid;
    }
}
